/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ventanaPrincipal.java
 *
 * Created on 8/04/2011, 04:46:38 AM
 */

package frontera.interfaz.ventana;

import control.SIRHApp;
import entidad.Cargo;
import entidad.Empleado;
import entidad.Prestacion;
import entidad.Usuario;
import frontera.interfaz.Pestana;
import frontera.interfaz.panel.PanelBusqueda;
import java.awt.Toolkit;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

/**
 *
 * @author usuario06
 */
public class VentanaPrincipal extends javax.swing.JFrame {

    /** Creates new form ventanaPrincipal */
    public VentanaPrincipal() {
        initComponents();
        java.net.URL url = ClassLoader.getSystemResource("frontera/recursos/ConsEmpleado.png");
        Toolkit kit = Toolkit.getDefaultToolkit();
        java.awt.Image img = kit.createImage(url);
        this.setIconImage(img);
        setPanelesIniciales();
        setLocationRelativeTo(null);
    }

    private void setPanelesIniciales(){
        for (Pestana p : SIRHApp.getInstance().getFactoryInterfaz().getPestanasPrincipal()){
            pestanasPrincipal.addTab(p.getNombre(), p.getIcono(),p.getPanel());
        }
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pestanasPrincipal = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Informacion Recursos Humanos");

        pestanasPrincipal.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
        pestanasPrincipal.setMaximumSize(new java.awt.Dimension(750, 550));
        pestanasPrincipal.setMinimumSize(new java.awt.Dimension(750, 550));
        pestanasPrincipal.setPreferredSize(new java.awt.Dimension(750, 550));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pestanasPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(pestanasPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 588, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void setPanelReclutamientoPrincipal (JPanel contenido){
         SIRHApp.getInstance().getFactoryInterfaz().setPanelReclutamientoPrincipal(contenido);
    }

    public void setPanelNominaPrestaciones (JPanel contenido){
        SIRHApp.getInstance().getFactoryInterfaz().setPanelNominaPrestaciones(contenido);
    }

    public void setPanelPersonalEmpleado(JPanel contenido){
        SIRHApp.getInstance().getFactoryInterfaz().setPanelPersonalEmpleado(contenido);
    }

    public void setPanelPersonalCargo(JPanel contenido){
        SIRHApp.getInstance().getFactoryInterfaz().setPanelPersonalCargo(contenido);
    }

    public void setPanelUsuariosPrincipal(JPanel contenido){
        SIRHApp.getInstance().getFactoryInterfaz().setPanelUsuariosPrincipal(contenido);
    }

    public void setPanelInicio(JPanel contenido) {
        SIRHApp.getInstance().getFactoryInterfaz().setPanelInicio(contenido);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaPrincipal().setVisible(true);
            }
        });
    }

    public PanelBusqueda<Empleado> getPanelEmpleados() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelEmpleados();
    }

    public PanelBusqueda<Cargo> getPanelCargos() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelCargos();
    }

    public PanelBusqueda<Prestacion> getPanelPrestaciones() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelPrestaciones();
    }

    public PanelBusqueda getPanelCandidatos() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelCandidatos();
    }
    
    public PanelBusqueda<Usuario> getPanelUsuarios() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelUsuarios();
    }

    public JPanel getPanelInicio() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelInicio();
    }

    public JTabbedPane getPestanasPrincipal() {
        return pestanasPrincipal;
    }

    public JTabbedPane getPestanasIntPersonal() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPestanasIntPersonal();
    }

    public JTabbedPane getPanelNominaPrincipal() {
        return SIRHApp.getInstance().getFactoryInterfaz().getPanelNominaPrincipal();
    }

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane pestanasPrincipal;
    // End of variables declaration//GEN-END:variables


}
